package router

import (
	"im/app"
	"net/http"
)

func Run(port string) {
	//绑定路由和处理函数
	//登录接口
	http.HandleFunc("/user/login", app.UserLogin)
	//注册接口
	http.HandleFunc("/user/register", app.UserRegister)
	//用户查找
	http.HandleFunc("/user/find", app.FindUser)
	//添加好友接口
	http.HandleFunc("/contact/addfriend",app.Addfriend)
	//获取好友列表接口
	http.HandleFunc("/contact/friend",app.LoadFriend)
	//获取群组接口
	http.HandleFunc("/contact/community",app.Community)
	// soket
	http.HandleFunc("/chat",app.Chat)
	//添加群组接口
	//提供静态资源的支持
	http.Handle("/asset/",http.FileServer(http.Dir(".")))
	//加载页面
	Show()
	//http服务器监听8080端口
	http.ListenAndServe(port,nil)
}
